<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>okCookie</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../css/oksub.css">
</head>
<body>
    <div class="ok-body">
        <blockquote class="layui-elem-quote">
            <p>JavaScript Cookies操作</p>
        </blockquote>
        <pre>
layui.use(["okCookie"], function () {
    let $ = layui.jquery;
    <br/>
    // 创建cookie
    $.cookie("hello", "word")

    // 读取cookie
    let hello = $.cookie("hello");
    console.log(hello);

    // 删除cookie
    $.cookie("hello", null);
});
        </pre>
    </div>
    <!--js逻辑-->
    <script src="../../lib/layui/layui.js"></script>
    <script>
        layui.use(["code", "okCookie"], function () {
            let code = layui.code;
            let $ = layui.jquery;

            code({
                elem: "pre",
                title: "代码示例"
            });

            // 创建cookie
            $.cookie("hello", "word")

            // 读取cookie
            let hello = $.cookie("hello");
            console.log(hello);

            // 删除cookie
            $.cookie("hello", null);
        });
    </script>
</body>
</html>
